//
//  RepairCadeCell.m
//  ICrEAM
//
//  Created by mac on 16/11/2.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "RepairCadeCell.h"
#import "RepairScheduleView.h"

@interface RepairCadeCell()
//服务顾问文本
@property (weak, nonatomic) IBOutlet UILabel *serviceManegerL;
@property (weak, nonatomic) IBOutlet UIView *lieseceBgView;
//车牌号
@property (weak, nonatomic) IBOutlet UILabel *liceseLable;
//出厂时间
@property (weak, nonatomic) IBOutlet UILabel *liceseTimeL;
//进厂时间
@property (weak, nonatomic) IBOutlet UILabel *getCarTimeL;
@property (weak, nonatomic) IBOutlet RepairScheduleView *scheduleView;
@property (weak, nonatomic) IBOutlet UIImageView *repairFirstImage;
@property (weak, nonatomic) IBOutlet UIImageView *repairThirdImage;
@property (weak, nonatomic) IBOutlet UIImageView *repairFourImage;
@property (weak, nonatomic) IBOutlet UIImageView *repairFiveImage;
@property (weak, nonatomic) IBOutlet UIImageView *repairSecodeImage;
@property (weak, nonatomic) IBOutlet UIImageView *repairSixImage;
@end
@implementation RepairCadeCell
+(instancetype)createRepairCadeCell{
    return [[[NSBundle mainBundle]loadNibNamed:@"RepairCadeCell" owner:nil options:nil]lastObject];
}
- (void)awakeFromNib {
    [super awakeFromNib];
    self.selectionStyle=UITableViewCellSelectionStyleNone;
    
    self.lieseceBgView.layer.cornerRadius=4;
    self.lieseceBgView.layer.masksToBounds=YES;
    
    self.lieseceBgView.backgroundColor=RGBA(30, 165, 255, 1);
    
    self.repairFirstImage.hidden=YES;
    self.repairSecodeImage.hidden=YES;
    self.repairThirdImage.hidden=YES;
    self.repairFourImage.hidden=YES;
    self.repairFiveImage.hidden=YES;
    self.repairSixImage.hidden=YES;
    
    // Initialization code
}
-(void)setRepaircadeModel:(RepaircadeResponse *)repaircadeModel{
    _repaircadeModel=repaircadeModel;
    BOOL ispast=NO;
    if (repaircadeModel.apartDeliveryTime.length>2) {
        ispast=[[repaircadeModel.apartDeliveryTime substringWithRange:NSMakeRange(0, 2)] isEqualToString:@"超时"];
    }
    //是否超时
    if (ispast) {
        self.lieseceBgView.backgroundColor= RGB(251, 179, 35);
        self.getCarTimeL.textColor= RGB(251, 179, 35);
        
    }else{
    self.lieseceBgView.backgroundColor=[ICrEAMTool isVW]?RGB(35, 193, 239):KSKBgColor;
    self.getCarTimeL.textColor=[UIColor textColor];
    }
    self.scheduleView.hideFirst=!repaircadeModel.haveBooking;
    self.scheduleView.isReception=repaircadeModel.haveReception;
    NSUInteger scrollcount=[repaircadeModel.repairStatus integerValue];
    self.scheduleView.shcedulenNum=scrollcount;
    self.liceseLable.text=repaircadeModel.license;
    self.serviceManegerL.text=repaircadeModel.SERVICE_ADVISOR;
    self.liceseTimeL.text=repaircadeModel.deliveryDate;
    self.getCarTimeL.text= (IsStrEmpty(repaircadeModel.deliveryStatus))?repaircadeModel.apartDeliveryTime:repaircadeModel.deliveryStatus;
    
    self.repairFirstImage.hidden=(self.repairFirstImage.tag-1000)==scrollcount?NO:YES;
    self.repairSecodeImage.hidden=(self.repairSecodeImage.tag-1000)==scrollcount?NO:YES;
    self.repairThirdImage.hidden=(self.repairThirdImage.tag-1000)==scrollcount?NO:YES;
    self.repairFourImage.hidden=(self.repairFourImage.tag-1000)==scrollcount?NO:YES;
    self.repairFiveImage.hidden=(self.repairFiveImage.tag-1000)==scrollcount?NO:YES;
    self.repairSixImage.hidden=(self.repairSixImage.tag-1000)==scrollcount?NO:YES;
        
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end
